package com.jrwd.recycletest.util.glideutil;

import android.content.Context;

import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.MemoryCategory;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.cache.ExternalCacheDiskCacheFactory;
import com.bumptech.glide.module.GlideModule;


/**
 * Created by Koma on 2017/6/6.
 * Description：Glide的全局配置
 * version 1.0 Content：
 */
public class GlobalGlideModule implements GlideModule{
    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        builder.setDiskCache(new ExternalCacheDiskCacheFactory(context,"image_xdyqdzs",50*1204*1024));//缓存在SD卡持久的数据

        builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888); //设置glider 的全局编码模式.
        
    }

    @Override
    public void registerComponents(Context context, Glide glide) {
        glide.setMemoryCategory(MemoryCategory.NORMAL); //设置缓存内存占用模式
    }
}
